package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.util.Utils;
import java.math.BigDecimal;

public class DECIMAL extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    return new BigDecimal(Utils.objectToNumber(paramArrayOfObject[0], false).doubleValue());
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "DECIMAL(number): 返回number的大数类型，常用于精确计算。";
  }

  public String getEN()
  {
    return "DECIMAL(number): Returns the BigDecimal type of number for precise calculate.\n";
  }
}